<h1>Listing employees</h1>

<table>
  <tr>
    <th>Name</th>
    <th>Surname</th>
    <th>Address</th>
    <th>Login</th>
	<th>Warehouse</th
  </tr>
  <tr align="center">
  <% form_tag :action => 'filter' do %></td>
    <td><%= text_field("filter", "employee_name", :size => 15) %></td>
	<td><%= text_field("filter", "employee_surname", :size => 15) %></td>
	<td><%= text_field("filter", "employee_address", :size => 40) %></td>
	<td><%= text_field("filter", "employee_login", :size => 15) %></td>
	<td><%= select("filter", "employee_warehouse", Warehouse.find(:all).collect {|w| [ w.name, w.id ] }, { :include_blank => true }) %></td>
    
    <td><input type="submit" value="Filter" /></td>
  <% end %>
  </tr>

<% @employees.each do |employee| %>
  <tr>
    <td><%=h employee.name %></td>
    <td><%=h employee.surname %></td>
    <td><%=h employee.address %></td>
    <td><%=h employee.login %></td>
	<td><%= link_to employee.warehouse.name, employee.warehouse %></td>
	<td/>
    <td><%= link_to 'Show', employee %></td>
    <td><%= link_to 'Edit', edit_employee_path(employee) %></td>
    <td><%= link_to 'Delete', employee, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New employee', new_employee_path %>